from django.contrib.auth.models import User
from django.db import models


# Create your models here.

class UserChat(models.Model):
    user = models.OneToOneField(to=User, verbose_name='用户', on_delete=models.CASCADE, related_name='chat', unique=True)
    online = models.BooleanField(default=False, verbose_name='是否在线')


class ChatGroups(models.Model):
    group_name = models.CharField(max_length=255, verbose_name='组名称', unique=True)
    users = models.ManyToManyField(to=UserChat, blank=True, verbose_name='用户组', related_name='belong_groups')
